package com.c.ctgproject.adapter.guang

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.c.ctgproject.R
import com.c.ctgproject.base.BaseEmptyRecyclerViewAdapter
import com.c.ctgproject.base.BaseEmptyRecyclerViewAdapterV2
import com.c.ctgproject.entity.guang.BatteryOutEntity
import com.c.ctgproject.entity.guang.HandlerBatteryDetailEntity
import com.c.ctgproject.utils.noDataHandler

class BatteryOutDetailAdapter(private val context: Context, private val mList: List<BatteryOutEntity.DataBean.ItemsBean>) : BaseEmptyRecyclerViewAdapterV2(context, mList) {

    override fun createViewHolder(parent: ViewGroup): RecyclerView.ViewHolder {
        val view = LayoutInflater.from(context).inflate(R.layout.item_battery_out_detail_list, parent, false)
        return MyViewHolder(view)
    }

    override fun handlerData(holder: RecyclerView.ViewHolder, position: Int) {
        if (holder is MyViewHolder) {
            val data = mList[position]
            holder.batteryName.text=data.batteryName.noDataHandler()
            holder.batteryCode.text=data.batteryCode.noDataHandler()
            holder.batterySelfCode.text=data.batterySelfCode.noDataHandler()
            holder.count.text=data.count.noDataHandler()
            holder.weight.text=data.weight.noDataHandler()
            holder.capacityAh.text=data.capacityAh.noDataHandler()
            holder.capacityKwh.text=data.capacityKwh.noDataHandler()
            holder.voltage.text=data.voltage.noDataHandler()
            holder.remark.text=data.remark.noDataHandler()
            holder.moduleCount.text=data.moduleCount.noDataHandler()

        }
    }

    inner class MyViewHolder(view: View) : RecyclerView.ViewHolder(view) {
        val moduleCount: TextView = view.findViewById(R.id.moduleCount)
        val batteryName: TextView = view.findViewById(R.id.batteryName)
        val batteryCode: TextView = view.findViewById(R.id.batteryCode)
        val batterySelfCode: TextView = view.findViewById(R.id.batterySelfCode)
        val count: TextView = view.findViewById(R.id.count)

        val weight: TextView = view.findViewById(R.id.weight)
        val capacityAh: TextView = view.findViewById(R.id.capacityAh)
        val capacityKwh: TextView = view.findViewById(R.id.capacityKwh)
        val voltage: TextView = view.findViewById(R.id.voltage)
        val remark: TextView = view.findViewById(R.id.remark)

    }
}